﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Linq;
using System.Collections.ObjectModel;

namespace AcctrueWMS.Foundation.Data
{
    public class DataModelLoder : IDataModelLoader
    {
        #region IDataModelLoader 成员

        public System.Collections.ObjectModel.Collection<DataModel> LoadModels(string path)
        {
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path);
            FileInfo[] xmls = dir.GetFiles("*.xml");
            Collection<DataModel> models = new Collection<DataModel>();
            foreach (FileInfo xml in xmls)
            {
                DataModel model = new DataModel(Web.Runtime.Context, xml.Name);
                models.Add(model);
            }
            return models;
        }

        #endregion
    }
}
